<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>02_observable | KnockOut.js</title>
  <script src="../assets/knockout-3.5.1.js"></script>
</head>
<body>

  <!-- 声明视图 -->
  <input data-bind="value: msg" />
  <span data-bind="text: num"></span>

  <script>
    // 声明 ViewModel
    var vm = {
      // msg: 'Hello, World',
      msg: ko.observable(),
      num: ko.observable()
    };

    // 操作
    vm.msg(123).num(777)
    // vm.num(666)

    // vm.msg()

    // 激活 KnockOut
    ko.applyBindings(vm);
  </script>
    
</body>
</html>